package gbportal.articles.domain.objects;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;

import java.util.Collection;

/**
 * @author Nikita.Brazhnikov
 */
public class ElementProperties {

	private Multimap<String, String> propertiesMap = ArrayListMultimap.create();

	public boolean addProperty(String key, String value) {
		return propertiesMap.put(key, value);
	}

	public String[] getProperties(String key) {
		Collection<String> result = propertiesMap.get(key);
		return result.toArray(new String[result.size()]);
	}

	public String getFirst(String key) {
		return Iterables.getFirst(propertiesMap.get(key), null);
	}
}
